package com.bsoft.comsumer;

import com.alibaba.fastjson.JSON;
import com.bsoft.message.Demo06Message;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
@RabbitListener(queues = Demo06Message.QUEUE,
        containerFactory = "consumerBatchContainerFactory")
public class Demo06Consumer {
 @RabbitHandler
    public  void  onMessage(List<Demo06Message> message){
        JSON.toJSONString(message);
        log.info("[onMessage][线程编号:{} 消息数量：{}]", Thread.currentThread().getId(), message.size());
    }
}
